* british analyses 


use "bes_long.dta", clear


xtset id wave
svyset [pweight=weights]


**** Analysis of UKIP VOTE 
svy: reg voteUKIP c.europe##i.wave learning_status  c.immigration##i.wave   c.ideology##i.wave    ///
            age_new  i.gender  i.educ_age i.working_status if wave!=1
      

margins, dydx(europe) at(  wave=(2 3)   )


svy: reg voteUKIP c.europe##i.wave##ib3.learning_status     ///
            age_new  i.gender  i.educ_age i.working_status if wave!=1
      
outreg2 using TABLE_Priming_UK_R2.doc, replace ctitle(Learning) label  nocon bd(2) sd(2)   r2


svy: reg voteUKIP c.europe##i.wave##ib3.learning_status  c.immigration##i.wave   c.ideology##i.wave    ///
            age_new  i.gender  i.educ_age i.working_status if wave!=1
      
outreg2 using TABLE_Priming_UK_R2.doc, append ctitle(Learning) label  nocon bd(2) sd(2)   r2

margins, dydx(europe) at(  wave=(2 3)  learning=(1(1)4) )



**** Cross-lagged models

svy: reg voteUKIP c.L.voteUKIP##i.wave   c.L.europe##i.wave  if learning_status  ==2 
  
outreg2 using TABLE_Learning_UK.doc, replace ctitle(Learning) label  nocon bd(2) sd(2)   

margins,  predict() at( wave=(2 3) L.europe =(0 1) )
marginsplot, leg(position(6)) yscale(range(0 .5)) ylabel(0(.1).5) aspect(1) scale(1.5)
graph save g1.gph, replace


 svy: reg europe  c.L.europe##i.wave  c.L.voteUKIP##i.wave if learning_status  ==2

outreg2 using TABLE_Learning_UK.doc, append ctitle(Opinion change) label  nocon bd(2) sd(2)   


margins,  predict() at( wave=(2 3) L.voteUKIP=(0 1))
marginsplot, leg(position(6)) yscale(range(.5 1)) ylabel(.5(.1)1) aspect(1) scale(1.5)
graph save g2.gph, replace


graph combine g1.gph g2.gph

